package br.com.managerprojectplugin.wizard;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

import br.com.managerprojectplugin.model.Usecase;

public class UsecaseNewWizardPage extends WizardPage {
	
	private Usecase uc;

	protected UsecaseNewWizardPage() {
		super("UsePageName"); //$NON-NLS-1$
		setTitle(Messages.UsecaseNewWizardPage_newusecase);
		setDescription(Messages.UsecaseNewWizardPage_createnewusecase);
		this.uc = new Usecase();
	}
	
	

	@Override
	public void createControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		container.setLayout(gridLayout);
		setControl(container);
		
		
		Label nomeLabel = new Label(container, SWT.NONE);
		nomeLabel.setText(Messages.UsecaseNewWizardPage_name);
		final Text nomeText = new Text(container, SWT.NONE);
		nomeText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setNome(nomeText.getText());
			}
		});
		
		Label nomeProjetoLabel = new Label(container, SWT.NONE);
		nomeProjetoLabel.setText(Messages.UsecaseNewWizardPage_projectname);
		final Text nomeProjetoText = new Text(container, SWT.NONE);
		nomeProjetoText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setNomeProjeto(nomeProjetoText.getText());
			}
		});
		
		Label descriptionLabel = new Label(container, SWT.LEFT);
		descriptionLabel.setText(Messages.UsecaseNewWizardPage_description);
		final Text descriptionText = new Text(container, SWT.BORDER);
		descriptionText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setProjetoDesc(descriptionText.getText());
			}
		});
		Label inicioLabel = new Label(container, SWT.LEFT);
		inicioLabel.setText(Messages.UsecaseNewWizardPage_begin);
		final Text inicioText = new Text(container, SWT.BORDER);
		inicioText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setInicio(inicioText.getText());
			}
		});
		Label terminoLabel = new Label(container, SWT.LEFT);
		terminoLabel.setText(Messages.UsecaseNewWizardPage_end);
		final Text terminoText = new Text(container, SWT.BORDER);
		terminoText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setTerminno(terminoText.getText());
			}
		});
		Label estadoLabel = new Label(container, SWT.LEFT);
		estadoLabel.setText(Messages.UsecaseNewWizardPage_status);
		final Text estadoText = new Text(container, SWT.BORDER);
		estadoText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				uc.setEstado(estadoText.getText());
			}
		});
		
		
	}
	public Usecase getUc() {
		return uc;
	}

}
